//
//  FirstTwoShowCell.m
//  DaJiHui
//
//  Created by Mac on 2017/9/27.
//  Copyright © 2017年 Hao. All rights reserved.
//

#import "FirstTwoShowCell.h"
#import "UIImageView+WebCache.h"

@interface FirstTwoShowCell()

@property (nonatomic, strong) UIImageView *imgView;

@end

@implementation FirstTwoShowCell

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.imgView.frame = self.bounds;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self initContentView];
    }
    return self;
}

- (void)initContentView
{
    [self addSubview:self.imgView];
}

- (UIImageView *)imgView
{
    if (!_imgView) {
        _imgView = [[UIImageView alloc] init];
        _imgView.backgroundColor = [UIColor redColor];
        _imgView.contentMode = UIViewContentModeScaleAspectFill;
    }
    return _imgView;
}

- (void)setIconUrl:(NSString *)iconUrl
{
    NSString *url = [self getPicUrl:iconUrl];
    if (url.length) {
        [self.imgView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://www.chaojihui123.com%@",[url substringFromIndex:8]]]];
    }
}

- (NSString *)getPicUrl:(id)pic
{
    if (pic == NULL || pic == nil) {
        return @"";
    }else if(pic == [NSNull class]){
        return @"";
    }else if (pic == [NSNull null]){
        return @"";
    }else if ([pic isEqualToString:@"null"]){
        return @"";
    }else{
        return pic;
    }
}

@end

